package com.naizhuai.ui.user.multtype;

import android.support.annotation.DrawableRes;
import android.support.annotation.IdRes;
import android.support.annotation.NonNull;
import android.support.annotation.StringDef;
import android.support.annotation.StringRes;

/**
 * @author：lichenxi
 * @date 2018/5/28 16
 * email：525603977@qq.com
 * Fighting
 */
public class PersonInfo implements Runnable {
    @DrawableRes
    public int resid;
    @NonNull
    public String infoName;
    @NonNull
    public String infoDetial;
    @NonNull
    public boolean isQrCode;
    @NonNull
    public boolean isarrow;
    public Runnable action;

   private boolean hasAction(){
       return action!=null;
   }

    public PersonInfo(@DrawableRes int resid, @NonNull String infoName, @NonNull String infoDetial,@NonNull boolean isQrcode,@NonNull Runnable action) {
        this(resid, infoName, infoDetial, false,isQrcode,action);
    }

    public PersonInfo(@DrawableRes int resid, @NonNull String infoName, @NonNull String infoDetial,@NonNull Runnable action) {
        this(resid, infoName, infoDetial, false,false,action);
    }

    public PersonInfo(@DrawableRes int resid, @NonNull String infoName, @NonNull boolean isarrow,@NonNull Runnable action) {
        this(resid, infoName, "", isarrow,false,action);
    }


    public PersonInfo(@DrawableRes int resid, @NonNull String infoName, @NonNull String infoDetial, @NonNull boolean isarrow,@NonNull boolean isQrCode,@NonNull Runnable action) {
        this.resid = resid;
        this.infoName = infoName;
        this.infoDetial = infoDetial;
        this.isQrCode=isQrCode;
        this.isarrow = isarrow;
        this.action=action;

    }

    @Override
    public void run() {
       if (hasAction()){
              action.run();
       }
    }
}